#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main()
{
	int arr[] = { 3,0,1 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	int val = 0;
	for (int i = 0; i < sz; i++)
	{
		val ^= arr[i];
	}

	for (int i = 0; i <= sz; i++)
	{
		val ^= i;
	}

	printf("%d\n", val);
	return 0;
}

void resever(int arr[], int began, int end)
{
	while (began < end)
	{
		int tmp = arr[began];
		arr[began] = arr[end];
		arr[end] = tmp;

		++began;
		--end;
	}
}

int main()
{
	int arr[] = { 1,2,3,4,5,6,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	int k = 0;
	scanf("%d", &k);
	
	if (k > sz)
	{
		k %= sz;
	}

	resever(arr, 0, sz - k - 1);
	resever(arr, sz - k, sz-1);
	resever(arr, 0, sz-1);

	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}

#include<stdlib.h>
#include<string.h>

int main()
{
	int arr[] = { 1,2,3,4,5,6,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	int k = 0;
	scanf("%d", &k);

	if (k > sz)
	{
		k %= sz;
	}

	int* tmp = (int*)malloc(sizeof(int) * sz);
	if (tmp == NULL)
	{
		perror("malloc()");
	}

	memcpy(tmp, arr + sz - k, sizeof(int) * k);
	memcpy(tmp + k, arr, sizeof(int) * (sz - k));
	memcpy(arr, tmp, sizeof(int) * sz);

	free(tmp);
	tmp = NULL;

	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}


	return 0;
}